<%@ page import="java.sql.ResultSet" %>
<%@ page import="br.com.rosena.control.ControllerRosena" %>
<%
    String query = "SELECT Q.ID , Q.DESCRICAO FROM QUERY Q WHERE Q.ID IS NOT NULL ORDER BY Q.DESCRICAO ";
    ResultSet crsConsultaPrincipal = new ControllerRosena().execultarQueryReturResultSet(query);
%>
<html>
<head><title>Gerador de Relatorio</title>
    <script type="text/javascript">
        function gerar(){
            var pagina = "/query.jsp?nomeClasse=Query&id="+frm.lstRelatorio.value;
            var width = 150;
            var height = 250;
            var left = 99;
            var top = 99;
            window.open(pagina,'_GERADOR_RELATORIO'+frm.lstRelatorio.value);
        }
    </script>
</head>
<body>
<table>
    <form name="frm">
        <tr>
            <td>
                Relatorio:<br>
                <select name="lstRelatorio">
                    <%while(crsConsultaPrincipal.next()){%>
                        <option value="<%=crsConsultaPrincipal.getString("ID")%>"><%=crsConsultaPrincipal.getString("descricao")%></option>
                    <%}%>
                </select>
                <input type="button" value="Gerar" onclick="gerar();">
            </td>
        </tr>
    </form>
</table>
</body>
</html>